<template>
  <div class='container'>
    <p class="illustrate">1111说明:目前支持学科和关键字条件筛选</p>
  <el-button type="success" 
  @click="addQuestion"
  class="add-test-btn"><i class="el-icon-edit"></i> 新增试题</el-button>
  <!-- 搜索区域 -->
  <div class="searchArea">
  <searchInfo></searchInfo>
  </div>
  <!-- 审核区域 -->
  <!-- tab栏切换 -->
  <div class="tab">
    <el-tabs type="card">
  <el-tab-pane label="全部">
  <!-- 全部 -->
  <div class="dataCount">
  <i class="el-icon-info"></i>
  数据一共{{tableData.counts}}条  
  </div>
  <renderlist :tableData="tableData"></renderlist>
  </el-tab-pane>
  <el-tab-pane label="待审核">
    <!-- 待审核 -->
  <div class="dataCount">
  <i class="el-icon-info"></i>
  数据一共{{}}条  
  </div>
  <renderlist :tableData="toBechk"></renderlist>
  </el-tab-pane>
  <el-tab-pane label="已审核">
    <!-- 已审核 -->
  <div class="dataCount">
  <i class="el-icon-info"></i>
  数据一共{{}}条  
  </div>
  <renderlist :tableData="chked"></renderlist>
  </el-tab-pane>
  <el-tab-pane label="已拒绝">
    <!-- 已拒绝 -->
  <div class="dataCount">
  <i class="el-icon-info"></i>
  数据一共{{}}条  
  </div>
  <renderlist :tableData="refused"></renderlist>
  </el-tab-pane>
</el-tabs>
  </div>
  </div>
</template>

<script>
import {dataFormate} from '../../utils/dataformat'
import {choice} from '../../api/hmmm/questions'
import renderlist from './renderlist.vue'
import searchInfo from '../components/search-info.vue'
export default {
  data() {
    return {
      toBechk:[],
      chked:[],
      refused:[],
      rowdata:[],
      tableData:[]
    }
  },
 async created() {
    let res= await choice()
    //数据格式化
    dataFormate(res.data.items)
    this.tableData=res.data.items
    //区分发布状态
    console.log(res.data.items);
    this.tableData.forEach(item=>{
      if(item.chkState==="通过"){
        this.chked.push(item)
      }else if(item.chkState==="待审核"){
        this.toBechk.push(item)
      }else{
        this.refused.push(item)
      }
    })

  },
  methods: {
     addQuestion(){
      this.$router.push({name:'questions-new'})
    }
  },
  components:{
    searchInfo,
    renderlist
    
  }
}
</script>

<style scoped lang='less'>
.container {
  padding: 20px;
  overflow: hidden;
  margin: 12px 8px;
  background-color: white;
  border-radius: 2px;
  box-shadow: 1px 1px 1px 1px rgb(231, 229, 229);
}
.illustrate {
  font-family: Helvetica Neue, Helvetica, PingFang SC, Hiragino Sans GB,
    Microsoft YaHei, Arial, sans-serif;
  font-size: 12px;
  float: left;
  color: rgb(255, 197, 218);
}
.add-test-btn {
  float: right;
}
.searchArea {
  margin-top: 60px;
}
.dataCount {
  background-color: rgb(244, 244, 245);
  border-radius: 2px;
  padding: 5px 20px;
  font-family: Helvetica Neue, Helvetica, PingFang SC, Hiragino Sans GB,
    Microsoft YaHei, Arial, sans-serif;
  font-size: 13px;
  color: rgb(157, 147, 153);
}
</style>
